//
//  CXWebDriver.h
//  Codex
//
//  Created by ChenJie on 01/02/2018.
//  Copyright © 2018 Mist. All rights reserved.
//

#import <AFNetworking/AFNetworking.h>
#import <Foundation/Foundation.h>

typedef void (^WebDriverProgressCallback)(NSProgress *progress);
typedef void (^WebDriverSuccessCallback)(id response);
typedef void (^WebDriverFailureCallback)(NSError *error);

@interface CXWebDriver : NSObject

+ (instancetype)sharedDriver;

/**
 * post form request
 */
- (NSURLSessionDataTask *)post:(NSString *)url
                    parameters:(NSDictionary *)parameters
                       success:(WebDriverSuccessCallback)success
                       failure:(WebDriverFailureCallback)failure;

/**
 * post form request with progress
 */
- (NSURLSessionDataTask *)post:(NSString *)url
                    parameters:(NSDictionary *)parameters
                      progress:(WebDriverProgressCallback)progress
                       success:(WebDriverSuccessCallback)success
                       failure:(WebDriverFailureCallback)failure;

@end
